local Modlanguage = GetModConfigData("modlanguage")
Musha_language = {
	[0] = "en",
	[1] = "en",
	[16] = "ru",
	[19] = "ko",
	[22] = "cn"
}
if Modlanguage == -1 then
	Musha_language = Musha_language[GLOBAL.Profile:GetLanguageID()]
else
	Musha_language = Musha_language[Modlanguage]
end
if not Musha_language then
	Musha_language = "en"
end
modimport("scripts/localization/strings_musha_common.lua")
STRINGS.CHARACTERS.MUSHA = require("localization/speech_musha_cn")
modimport("scripts/localization/strings_musha_cn.lua")
--STRINGS.CHARACTERS.MUSHA = require("speech_musha_" .. Musha_language)
--modimport("scripts/strings_musha_" .. Musha_language .. ".lua")

--------------------------------------------------Musha Setting---------------------------------------
GLOBAL.MUSHA_SETTINGS = {}
GLOBAL.MUSHA_SETTINGS.musha_settings = {
	damage = GetModConfigData("difficult_damage"),
	range_damage = GetModConfigData("difficult_damage_range"),
	level_difficulty = GetModConfigData("musha_level_difficulty"),
	max_exp = 1500 * GetModConfigData("musha_level_difficulty"),
	Dtired = GetModConfigData("difficult_tired"),
	Dsleep = GetModConfigData("difficult_sleep"),
	Dmana = GetModConfigData("difficult_mana"),
	treasure_recharge_multiple = GetModConfigData("difficulty_sniff"),
	music_recharge_multiple = GetModConfigData("difficult_music"),
	musha_intelligence = GetModConfigData("musha_intelligence"),
	lightning_sound = GetModConfigData("lightning_sound"),
	princess_sleep = GetModConfigData("princess_sleep"),
	princess_taste = GetModConfigData("princess_taste"),
	edible_food_type = GetModConfigData("edible_food_type"),
	dis_food_type = GetModConfigData("dis_food_type"),
	shadowhide_real = GetModConfigData("shadowhide_real"),
	hud = GetModConfigData("hud"),
	Keys = {
		LEVEL_INFO = GetModConfigData("level_info") or 108, --L
		SPECIALATTACKSWITCH = GetModConfigData("specialattackswitch") or 114, --R
		ELECTRICSHIELD = GetModConfigData("electricshield") or 99, --C
		SING = GetModConfigData("sing") or 111, --O
		SKILL_UI = GetModConfigData("skill_ui") or 107, --K
		SNIFF = GetModConfigData("sniff") or 117, --U
		ORDER_MUSHA_YAMCHE_2 = GetModConfigData("order_musha_yamche_2") or 98, --B
		ORDER_MUSHA_YAMCHE_1 = GetModConfigData("order_musha_yamche_1") or 110, --N
		SHADOWHIDE = GetModConfigData("shadowhide") or 103, --G
		SLEEP_SWITCH = GetModConfigData("sleep_switch") or 116, --T
		ORDER_MUSHA_BEEFALO = GetModConfigData("order_musha_beefalo") or 282, --F1
		ORDER_MUSHA_MOONTREE = GetModConfigData("order_musha_moontree") or 283 --F2
	}
}

--TheNet:GetPVPEnabled()
if TheNet:GetIsServer() then
	GLOBAL.MUSHA_SETTINGS.share_item = GetModConfigData("share_items")
	GLOBAL.MUSHA_SETTINGS.no_armor_limit = GetModConfigData("no_armor_limit")
	GLOBAL.MUSHA_SETTINGS.no_butterfly_shield = GetModConfigData("no_butterfly_shield")
	GLOBAL.MUSHA_SETTINGS.no_followers = GetModConfigData("musha_moontree_followers")
	GLOBAL.MUSHA_SETTINGS.musha_skilldata = {
		ShadowHide = {
			{sanity_need = 50, prepare_time = 5, damage = 75},
			{sanity_need = 40, prepare_time = 4, damage = 140},
			{sanity_need = 25, prepare_time = 3, damage = 325}
		},
		ElectricAttack = {
			{spellpowercost = 10, damage = 15, cooldowntime = 8},
			{spellpowercost = 7, damage = 25, cooldowntime = 5},
			{spellpowercost = 5, damage = 40, cooldowntime = 3},
			cooldown = false,
			enable = false
		},
		PoisonAttack = {
			{spellpowercost = 5, damage = 5},
			{spellpowercost = 8, damage = 10},
			{spellpowercost = 12, damage = 15},
			enable = false
		},
		ElectricShield = {
			{
				spellpowercost = 40,
				damage = 0,
				duration = 8,
				cooldowntime = 80
			},
			{
				spellpowercost = 30,
				damage = 0,
				duration = 8,
				cooldowntime = 60
			},
			{
				spellpowercost = 25,
				damage = 0,
				duration = 7,
				cooldowntime = 45
			},
			{
				spellpowercost = 20,
				damage = 0,
				duration = 6,
				cooldowntime = 25
			},
			{
				spellpowercost = 10,
				damage = 0,
				duration = 4,
				cooldowntime = 15
			},
			cooldown = false,
			enable = false
		},
		FireShield = {
			{avoidance = 0.5, cooldowntime = 80},
			{avoidance = 0.65, cooldowntime = 65},
			{avoidance = 0.8, cooldowntime = 50},
			{avoidance = 0.9, cooldowntime = 40},
			{avoidance = 1.0, cooldowntime = 35},
			refresh = false,
			enable = false
		},
		PowerAttack = {
			{spellpowercost = 15, damage = 1.2, shieldtime = 1.2},
			{spellpowercost = 12, damage = 1.35, shieldtime = 1.25},
			{spellpowercost = 9, damage = 1.55, shieldtime = 1.35},
			{spellpowercost = 7, damage = 1.85, shieldtime = 1.4},
			{spellpowercost = 5, damage = 2, shieldtime = 1.5}
		},
		Valkyr = {
			[0] = {damage = 0.5, avoidance = 0},
			{damage = 0.6, avoidance = 0.03},
			{damage = 0.7, avoidance = 0.05},
			{damage = 0.8, avoidance = 0.07},
			{damage = 0.9, avoidance = 0.09},
			{damage = 1, avoidance = 0.1}
		},
		Berserk = {{damage = 0.9}, {damage = 1.1}, {damage = 1.25}}
	}

--[[ 
	function never_eat(inst)
		inst:AddTag("no_edible")
	end
	AddPrefabPostInit("powcake", never_eat)
	AddPrefabPostInit("spoiled_food", never_eat) 
	]]
end

local frostblade3rd = GetModConfigData("frostblade3rd")

function frostblade_3rdbooster(inst)
	if frostblade3rd == 2 then
		inst.frostblade3rd_spear = true
	end
	if frostblade3rd == 3 then
		inst.frostblade3rd_spear = true
		inst.frostblade3rd_spear_range = true
	end
end
AddPrefabPostInit("musha_sword_frost", frostblade_3rdbooster)

function back_mushaa_visual(inst)
	inst.visual = GetModConfigData("avisual_musha")
end
AddPrefabPostInit("musha_armor_original", back_mushaa_visual)

function back_mushab_visual(inst)
	inst.visual = GetModConfigData("avisual_princess")
end
AddPrefabPostInit("musha_armor_princess", back_mushab_visual)

function armor_musha_armor_shadow_visual(inst)
	inst.armor_visual = GetModConfigData("avisual_pirate_armor")
end
AddPrefabPostInit("musha_armor_shadow", armor_musha_armor_shadow_visual)

function back_musha_armor_shadow_visual(inst)
	inst.back_visual = GetModConfigData("avisual_pirate")
end
AddPrefabPostInit("musha_armor_shadow", back_musha_armor_shadow_visual)
